﻿<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>学校食堂安全管理系统v1.0</title>

    <!-- Bootstrap Core CSS -->
    <link href="../vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="../vendor/metisMenu/metisMenu.min.css" rel="stylesheet">

    <!-- DataTables CSS -->
    <link href="../vendor/datatables-plugins/dataTables.bootstrap.css" rel="stylesheet">

    <!-- DataTables Responsive CSS -->
    <link href="../vendor/datatables-responsive/dataTables.responsive.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="../dist/css/sb-admin-2.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="../vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" type="text/css" href="../datepicker/need/laydate.css" />
    <link rel="stylesheet" type="text/css" href="../dist/css/extendcss.css" />
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>
    <div id="wrapper">
        <!-- Navigation -->
        <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="sr-only">Toggle </span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
            </div>
            <!-- /.navbar-header -->

            <ul class="nav navbar-top-links navbar-right">
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="fa fa-envelope fa-fw"></i> <i class="fa fa-caret-down"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-messages">
                        <li>
                            <a href="#">
                                <div>
                                    <strong>John Smith</strong>
                                    <span class="pull-right text-muted">
                                        <em>Yesterday</em>
                                    </span>
                                </div>
                                <div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <strong>John Smith</strong>
                                    <span class="pull-right text-muted">
                                        <em>Yesterday</em>
                                    </span>
                                </div>
                                <div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <strong>John Smith</strong>
                                    <span class="pull-right text-muted">
                                        <em>Yesterday</em>
                                    </span>
                                </div>
                                <div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a class="text-center" href="#">
                                <strong>Read All Messages</strong>
                                <i class="fa fa-angle-right"></i>
                            </a>
                        </li>
                    </ul>
                    <!-- /.dropdown-messages -->
                </li>
                <!-- /.dropdown -->
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="fa fa-tasks fa-fw"></i> <i class="fa fa-caret-down"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-tasks">
                        <li>
                            <a href="#">
                                <div>
                                    <p>
                                        <strong>Task 1</strong>
                                        <span class="pull-right text-muted">40% Complete</span>
                                    </p>
                                    <div class="progress progress-striped active">
                                        <div class="progress-bar progress-bar-success" role="progressbar"
                                            aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: 40%">
                                            <span class="sr-only">40% Complete (success)</span>
                                        </div>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <p>
                                        <strong>Task 2</strong>
                                        <span class="pull-right text-muted">20% Complete</span>
                                    </p>
                                    <div class="progress progress-striped active">
                                        <div class="progress-bar progress-bar-info" role="progressbar"
                                            aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style="width: 20%">
                                            <span class="sr-only">20% Complete</span>
                                        </div>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <p>
                                        <strong>Task 3</strong>
                                        <span class="pull-right text-muted">60% Complete</span>
                                    </p>
                                    <div class="progress progress-striped active">
                                        <div class="progress-bar progress-bar-warning" role="progressbar"
                                            aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%">
                                            <span class="sr-only">60% Complete (warning)</span>
                                        </div>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <p>
                                        <strong>Task 4</strong>
                                        <span class="pull-right text-muted">80% Complete</span>
                                    </p>
                                    <div class="progress progress-striped active">
                                        <div class="progress-bar progress-bar-danger" role="progressbar"
                                            aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 80%">
                                            <span class="sr-only">80% Complete (danger)</span>
                                        </div>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a class="text-center" href="#">
                                <strong>See All Tasks</strong>
                                <i class="fa fa-angle-right"></i>
                            </a>
                        </li>
                    </ul>
                    <!-- /.dropdown-tasks -->
                </li>
                <!-- /.dropdown -->
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="fa fa-bell fa-fw"></i> <i class="fa fa-caret-down"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-alerts">
                        <li>
                            <a href="#">
                                <div>
                                    <i class="fa fa-comment fa-fw"></i> New Comment
                                    <span class="pull-right text-muted small">4 minutes ago</span>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <i class="fa fa-twitter fa-fw"></i> 3 New Followers
                                    <span class="pull-right text-muted small">12 minutes ago</span>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <i class="fa fa-envelope fa-fw"></i> Message Sent
                                    <span class="pull-right text-muted small">4 minutes ago</span>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <i class="fa fa-tasks fa-fw"></i> New Task
                                    <span class="pull-right text-muted small">4 minutes ago</span>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <i class="fa fa-upload fa-fw"></i> Server Rebooted
                                    <span class="pull-right text-muted small">4 minutes ago</span>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a class="text-center" href="#">
                                <strong>See All Alerts</strong>
                                <i class="fa fa-angle-right"></i>
                            </a>
                        </li>
                    </ul>
                    <!-- /.dropdown-alerts -->
                </li>
                <!-- /.dropdown -->
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-user">
                        <li><a href="#"><i class="fa fa-user fa-fw"></i> User Profile</a>
                        </li>
                        <li><a href="#"><i class="fa fa-gear fa-fw"></i> Settings</a>
                        </li>
                        <li class="divider"></li>
                        <li><a href="login.html"><i class="fa fa-sign-out fa-fw"></i> Logout</a>
                        </li>
                    </ul>
                    <!-- /.dropdown-user -->
                </li>
                <!-- /.dropdown -->
            </ul>
            <!-- /.navbar-top-links -->

            <div class="navbar-default sidebar" role="navigation">
                <div class="sidebar-nav navbar-collapse">
                    <ul class="nav" id="side-menu">
                        <!--<li class="sidebar-search">
                            <div class="input-group custom-search-form">
                                <input type="text" class="form-control" placeholder="Search...">
                                <span class="input-group-btn">
                                <button class="btn btn-default" type="button">
                                    <i class="fa fa-search"></i>
                                </button>
                            </span>
                            </div>
                        </li>-->
                        <li>
                            <a href="#"><i class="fa fa-bar-chart-o fa-fw"></i> 库存管理<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="receiptplanlist.html">进货计划</a>
                                </li>
                                <li>
                                    <a href="signlist.html">进货签收</a>
                                </li>
                                <li>
                                    <a href="boundin.html">入库管理</a>
                                </li>
                                <li>
                                    <a href="boundout.html">出库管理</a>
                                </li>
                                <li>
                                    <a href="inventory.html">盘点管理</a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-bar-chart-o fa-fw"></i> 供货管理<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="ghsend.html">送货单管理</a>
                                </li>
                                <li>
                                    <a href="ghreceive.html">收款单管理</a>
                                </li>
                            </ul>
                            <!-- /.nav-second-level -->
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-wrench fa-fw"></i> 财务管理<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="cwreceive.html">收款管理</a>
                                </li>
                                <li>
                                    <a href="cwpay.html">付款管理</a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-wrench fa-fw"></i> 统计分析<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="tjin.html">进货单查询</a>
                                </li>
                                <li>
                                    <a href="tjout.html">出库汇总表</a>
                                </li>
                                <li>
                                    <a href="tjinsum.html">入库汇总表</a>
                                </li>
                                <li>
                                    <a href="tjhasdetail.html">存货明细账</a>
                                </li>
                                <li>
                                    <a href="tjshouldpay.html"> 应付货款报告</a>
                                </li>
                                <li>
                                    <a href="tjsource.html">食材来源统计</a>
                                </li>
                            </ul>
                            <!-- /.nav-second-level -->
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-sitemap fa-fw"></i>基础数据<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="unitlist.html">单位管理</a>
                                </li>
                                <li>
                                    <a href="supplierlist.html">供应商管理</a>
                                </li>
                                <li>
                                    <a href="foodclasslist.html">菜品类别</a>
                                </li>
                                <li>
                                    <a href="foodlist.html">菜品管理</a>
                                </li>
                                <!--<li>
                                    <a href="#">Third Level <span class="fa arrow"></span></a>
                                    <ul class="nav nav-third-level">
                                        <li>
                                            <a href="#">Third Level Item</a>
                                        </li>
                                        <li>
                                            <a href="#">Third Level Item</a>
                                        </li>
                                        <li>
                                            <a href="#">Third Level Item</a>
                                        </li>
                                        <li>
                                            <a href="#">Third Level Item</a>
                                        </li>
                                    </ul>                                   
                                </li>-->
                            </ul>
                            <!-- /.nav-second-level -->
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-files-o fa-fw"></i> 系统管理<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="userlist.html">用户管理</a>
                                </li>
                                <li>
                                    <a href="editpassword.html">修改密码</a>
                                </li>
                                <li>
                                    <a href="log.html">日志管理</a>
                                </li>
                                <li>
                                    <a href="login.html">退出系统</a>
                                </li>
                            </ul>
                            <!-- /.nav-second-level -->
                        </li>
                    </ul>
                </div>
                <!-- /.sidebar-collapse -->
            </div>
            <!-- /.navbar-static-side -->
        </nav>

        <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading row">
                            <div class="col-sm-6"> 当前位置: 库存管理 >进货签收</div>
                            <div class="col-sm-6">
                                <div class="optiondiv"><button type="button" class="btn btn-primary btn-sm"
                                        id="btncreate">新增</button>&nbsp;<button type="button"
                                        class="btn btn-primary btn-sm" id="btnedit">编辑</button>&nbsp;<button
                                        type="button" class="btn btn-primary btn-sm" id="delete">删除</button></div>
                            </div>
                        </div>
                        <div class="row panel-body">
                            <form class="form-inline" role="form">
                                <div class="form-group">
                                    <div class="input-group">
                                        <div class="input-group-addon">送货日期从：</div>
                                        <input class="form-control" type="text" placeholder="2016-06-15" id="datestart">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="input-group">
                                        <div class="input-group-addon">-到-</div>
                                        <input class="form-control" type="text" placeholder="2016-09-15" id="dateend">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="input-group">
                                        <div class="input-group-addon">采购单位</div>
                                        <select class="form-control" id="s_supplier">
                                            <option>全部</option>
                                            <option>武胜县双兴商贸有限公司</option>
                                            <option>源代码食品有限公司</option>
                                            <option>元祖月饼</option>
                                            <option>金威啤酒</option>
                                            <option>天伦月饼</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="input-group">
                                        <div class="input-group-addon">签收状态</div>
                                        <select class="form-control" id="s_state">
                                            <option>全部</option>
                                            <option>已签收</option>
                                            <option>未签收</option>
                                        </select>
                                    </div>
                                </div>
                                <button type="button" class="btn btn-default" id="btnsearch">查询</button>
                            </form>
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <table width="100%" class="table table-striped table-bordered table-hover"
                                id="dataTables-example">
                                <thead>
                                    <tr>
                                        <th class="center"><input type="checkbox" id="cball" /></th>
                                        <th class="center">序号</th>
                                        <th class="center">送货单编号</th>
                                        <th class="center">单据日期</th>
                                        <th class="center">采购单位</th>
                                        <th class="center">签收状态</th>
                                        <th class="center">签收时间</th>
                                        <th class="center">签收人</th>
                                        <th class="center">签收备注</th>
                                    </tr>
                                </thead>
                                <tbody id="stockform">
                                </tbody>
                            </table>
                            <!-- /.table-responsive -->
                            <form class="form-horizontal panel-body" role="form">
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">送货人：</label>
                                    <div class="col-sm-3">
                                        <input type="email" class="form-control" id="supname" placeholder="送货人">
                                    </div>
                                    <div class="col-sm-4"></div>
                                    <label for="inputPassword3" class="col-sm-1 control-label">签收人：</label>
                                    <div class="col-sm-3">
                                        <input type="text" class="form-control" id="signed" placeholder="签收人">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-sm-1 control-label">备注：</label>
                                    <div class="col-sm-11">
                                        <textarea class="form-control" rows="3" id="signrem"
                                            placeholder="录入备注信息"></textarea>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-offset-1 col-sm-10">
                                        <button type="submit" class="btn btn-default" id="sign">签收</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>

                <!-- /.col-lg-12 -->
            </div>



        </div>


    </div>
    <!-- /#wrapper -->

    <!-- jQuery -->
    <script src="../vendor/jquery/jquery.min.js"></script>
    <script src="../js/template-web.js" type="text/javascript" charset="utf-8"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="../vendor/bootstrap/js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="../vendor/metisMenu/metisMenu.min.js"></script>

    <!-- DataTables JavaScript -->
    <script src="../vendor/datatables/js/jquery.dataTables.min.js"></script>
    <script src="../vendor/datatables-plugins/dataTables.bootstrap.min.js"></script>
    <script src="../vendor/datatables-responsive/dataTables.responsive.js"></script>

    <script src="../dist/js/sb-admin-2.js"></script>
    <script src="../dist/js/sea.js"></script>
    <script src="../datepicker/laydate.dev.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/template" id="tmpl">
        <!-- 创建模板标签，进行遍历 -->
        {{each data as value index}}
        <tr class="odd gradeX">
            <td class="center"><input type="checkbox" class="ischeck" value="{{value._id}}" /></td>
            <td>{{value.num}}</td>
            <td><a href=" signdetail.html#id={{value._id}}">{{value.delnumber}}</a></td>
            <td>{{value.newtime}}</td>
            <td>{{value.supplier}}</td>
            {{if value.state=="已签收"}}
            <td><span>{{value.state}}</span></td>
            {{/if}}
            {{if value.state=="未签收"}}
            <td><span class="colorred">{{value.state}}</span></td>
            {{/if}}
            <td>{{value.signtime}}</td>
            <td>{{value.signed}}</td>
            <td>{{value.signrem}}</td>
        </tr>
        {{/each}}
    </script>
    <script>
        //在页面上渲染
        showpage();

        // function showpage() {
        //     $.get("/stock/delform", function (data) {
        //         var html = template("tmpl", {
        //             data
        //         })
        //         $("#stockform").html(html)
        //     })
        // }

        laydate({
            elem: '#datestart'
        });
        laydate({
            elem: '#dateend'
        });
        $("#cball").click(function () {
            $("input[type='checkbox']").not(this).prop("checked", $(this).prop("checked"));
        });

        seajs.config({
            alias: {
                "jquery": "jquery-1.10.2.js"
            }
        });

        seajs.use(['jquery', 'dialog-plus'], function ($, dialog) {

            //增加
            $('#btncreate').on('click', function () {
                //构造表单
                jQuery.get("supplierform.html", function (data) {
                    var d = dialog({
                        title: '创建供应商',
                        content: data,
                        width: 500,
                        okValue: '确 定',
                        ok: function () {
                            //获取表单上的值
                            var num = $("#num").val();
                            var supplier = $("#tbunitname").val();
                            var supplierid = $("#tbaddress").val();
                            var supname = $("#tbcontact").val();
                            var tele = $("#tbtel").val();
                            var foodname = $("#fenlei").val();
                            var endname = $("#tbusername").val();
                            var endbank = $("#tbbank").val();
                            var endnumber = $("#tbbanknum").val();
                            var date = new Date();
                            var y = date.getFullYear();
                            var s = date.getMonth();
                            var d = date.getDate();
                            var m = s + 1;
                            var number = "JHD" + y + "0" + m + d + "0" + num;
                            var delnumber = "SHD" + y + "0" + m + d + "0" + num;
                            var newtime = y + "-" + m + "-" + d;
                            obj = {
                                supplier,
                                supplierid,
                                supname,
                                tele,
                                foodname,
                                endname,
                                endbank,
                                endnumber,
                                number,
                                delnumber,
                                newtime,
                            }
                            // console.log(obj)
                            //发起请求
                            $.post("/stock/addsign", obj, function (data) {
                                if (data == 1) {
                                    alert("新增数据成功...")
                                    showpage();
                                }
                            })

                        },
                        cancelValue: '取消',
                        cancel: function () {}
                    });

                    d.showModal();
                });
            });



            //删除
            $("#delete").click(function () {
                var iis = 0;
                var checkarr = [];
                //用于判断是否有选中值
                $(".ischeck").each(function (i, v) {
                    if ($(this).prop("checked")) {
                        iis++;
                    }
                })
                //判断是否选中列表
                if (iis > 0) {
                    $(".ischeck").each(function (i, v) {

                        if ($(this).prop("checked")) {
                            checkarr.push($(this).val()); //将所有的id值传入空数组
                        }

                    })
                    $.get("/stock/deletemore", {
                        data: checkarr
                    }, function (data) {
                        if (data = "1") {
                            alert("删除成功....")
                            showpage();
                        } else {
                            alert("删除失败....")
                            showpage();
                        }
                    })
                } else {
                    alert("请选择数据......")
                }

            })

            //签收
            $('#sign').click(function () {
                var onlyi = 0;
                var idc;
                $(".ischeck").each(function (i, v) {
                    if ($(this).prop("checked")) {
                        onlyi++;
                        idc = $(this).val()
                    }
                })
                if (onlyi == 0) {
                    alert("请选择需要签收的订单...")
                } else if (onlyi == 1) {
                    location.href = "signlist.html#id=" + idc
                    var ide = location.hash.split("=")[1];
                    var date = new Date();
                    var y = date.getFullYear();
                    var s = date.getMonth();
                    var d = date.getDate();
                    var m = s + 1;
                    if (m < 10) {
                        mm = "0" + m
                    } else {
                        mm = m
                    }
                    if (d < 10) {
                        d = "0" + date.getDate();
                    } else {
                        d = date.getDate();
                    }
                    var mm = s + 1;
                    var signtime = y + "-" + mm + "-" + d;

                    var supname = $("#supname").val();
                    var signed = $("#signed").val();
                    var signrem = $("#signrem").val();
                    obj = {
                        ide,
                        signtime,
                        supname,
                        signed,
                        signrem
                    }
                    $.post("/stock/editsignlist", obj, function (data) {
                        if (data == 1) {
                            showpage();
                            alert("签收成功.....")
                        } else {
                            alert("签收失败.....")
                        }
                    })

                } else {
                    alert("只能选择一条数据......")
                }

            });
            //编辑修改
            $('#btnedit').on('click', function () {

                //判断多选框唯一选中
                var onlyi = 0;
                var editid;
                $(".ischeck").each(function (i, v) {
                    if ($(this).prop("checked")) {
                        onlyi++;
                        editid = $(this).val()
                    }
                })
                if (onlyi == 1) {
                    location.href = "signlist.html#id=" + editid
                    //构造表单
                    jQuery.get("supplierdit.html", function (data) {
                        var d = dialog({
                            title: '编辑用户',
                            content: data,
                            width: 500,
                            okValue: '确 定',
                            ok: function () {
                                //获取表单的值
                                var edid = location.hash.split("=")[1];
                                var num = $("#num").val();
                                var supplier = $("#tbunitname").val();
                                var supplierid = $("#tbaddress").val();
                                var supname = $("#tbcontact").val();
                                var tele = $("#tbtel").val();
                                var foodname = $("#fenlei").val();
                                var endname = $("#tbusername").val();
                                var endbank = $("#tbbank").val();
                                var endnumber = $("#tbbanknum").val();
                                var date = new Date();
                                var y = date.getFullYear();
                                var s = date.getMonth();
                                var d = date.getDate();
                                var m = s + 1;
                                var number = "JHD" + y + "0" + m + d + "0" + num;
                                var delnumber = "SHD" + y + "0" + m + d + "0" + num;
                                var newtime = y + "-" + m + "-" + d;
                                obj = {
                                    num,
                                    edid,
                                    supplier,
                                    supplierid,
                                    supname,
                                    tele,
                                    foodname,
                                    endname,
                                    endbank,
                                    endnumber,
                                    number,
                                    delnumber,
                                    newtime,
                                }
                                console.log(obj)
                                //发起请求
                                $.post("/stock/editsign", obj, function (data) {
                                    if (data == 1) {
                                        showpage();
                                        alert("修改成功.....")
                                    } else {
                                        alert("修改失败.....")
                                    }
                                })
                            },
                            cancelValue: '取消',
                            cancel: function () {}
                        });

                        d.showModal();
                    });
                } else if (onlyi == 0) {
                    alert("请选中一条数据......")
                } else {
                    alert("只能选择一条数据!!")
                }

            });
        });


        //查询/渲染
        function showpage() {
            var s_supplier = $("#s_supplier").val();
            var s_state = $("#s_state").val();
            var obj = {
                s_supplier,
                s_state,
            }
            $.get("/stock/delform", obj, function (data) {
                var html = template("tmpl", {
                    data
                })
                $("#stockform").html(html)
            })
        }


        $("#btnsearch").click(function () {
            showpage()
        })
    </script>



</body>

</html>